<? 
session_start();
if(!session_is_registered(uid)){
    echo "You have to login to view this page!</br></br>";
    echo "Click here to return to the "; 
    echo '<a href="./../index.php" title="Login">Login Page</a></br></br>';
    echo "Or sign up using this link ";
    echo '<a href="./../Registration/registration.html" title="Registration">Registration Page</a>';
exit();
}
else
    //Add tank form option
    include 'userprofile.php';
    
    //Manual SQL Connection
    $con = mysql_connect("localhost", "root", "root") or die ( "Error connectiong to DB: ".mysql_error());
       
    mysql_select_db("reeferslog", $con) or die ( "Error selecting specific DB, reefeerslog: ".mysql_error());
    
    //Variables
    $username = $_POST['uid'];
    $password = $_POST['password'];
    $email = $_POST['email'];
    $fname = $_POST['fname'];
    $lname = $_POST['lname'];
      
    //SQL Query to add tank info
    $updateuser = "update users set username=$username password=$password email=$email fname=$fname lname=$lname where user_id='". $_SESSION['uid'] ."'";

        //Execute Insert command
        if (!mysql_query($updateuser,$con))
            {
              die('Error: ' . mysql_error());
            }
            echo "User profile updated successfully!"; 
               
    //Close SQL input
    mysql_close($con);
?>